﻿namespace NpPuzzleGame
{
	public class Block
	{
		private int left;
		private int top;
		private int width;
		private int height;

		public Block(int left, int top, int width, int height)
		{
			this.left = left;
			this.top = top;
			this.width = width;
			this.height = height;
		}

		public int Left { get { return this.left; } }
		public int Right { get { return this.left + this.width; } }
		public int Top { get { return this.top; } }
		public int Bottom { get { return this.top + this.height; } }
		public int Width { get { return this.width; } }
		public int Height { get { return this.height; } }

		public bool IsCollision(int left, int top, int right, int bottom)
		{
			int thisRight = this.left + this.width;
			int thisBottom = this.top + this.height;

			return !(
				this.left > right ||
				thisRight < left ||
				this.top > bottom ||
				thisBottom < top);
		}
	}
}